﻿// -----------------------------------------------------------------------
// <copyright file="Gravatar.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace LifeInSharePoint.Common
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// Helper for getting Gravatar images
    /// </summary>

    public static class Gravatar
    {
        #region Public Static Functions

        /// <summary>
        /// Gets a Gravatar image link
        /// </summary>
        /// <param name="Email">Email identifier</param>
        /// <param name="AppendJPG">Should jpg be appended to the link?</param>
        /// <returns>The full path to the Gravatar image link</returns>
        public static string GetImageLink(string Email, bool AppendJPG = false)
        {
            string Ending = AppendJPG ? ".jpg" : "";
            return "http://www.gravatar.com/avatar/" + Utilities.ComputeHash(Email.Trim().ToLower()).ToLower() + Ending;
        }
        #endregion
    }
}
